<template>
    <div>
         <!--表单区域--->
      <div class ='udlite-container partners'>
      <van-cell-group>
      <van-field v-model="username" label = '用户名' placeholder="请输入用户名"/>
      <van-field v-model="password" label = '密 码' placeholder="请输入密 码"/>
      <van-field v-model="password1" label = '确认密码' placeholder="请确认密码"/>
      <van-field v-model="pthone" label = '手机号码' placeholder="请确认手机号码"/>
      <van-field v-model="emial" label = '邮箱' placeholder="请输入邮箱"/>
      <van-button type="primary" @click="submit">注册</van-button>
      <van-button type="info">重置</van-button>
      </van-cell-group>
      <button> <router-link to='denglu'>跳转到登录</router-link></button>
      </div>



    <!--表单区域--->
    
    
    </div>
</template>

<script>
import axios from 'axios'

export default {
     data() {
    return {
      username:'',
      password:'',
      password1:'',
      pthone:'',
      emial:''
    
    };
  },
    components:{
      
    },
     methods: {


    logout(){
      localStorage.removeItem('username')
      localStorage.removeItem('username')
    },
    submit(){
      if(this.username == ''){
        this.$toast('请填写用户名');
        return false;
      }
      if(this.password != this.password1){
        this.$toast('两次密码不正确');
        return false;
      }
      if(this.password1 == ''){
        this.$toast('请填写确认密码');
        return false; 
      }
      if(this.password == ''){
        this.$toast('请填写密码');
        return false; 
      }
      if(this.pthone == ''){
        this.$toast('请填写手机号');
        return false;
      }
      if(this.emial == ''){
        this.$toast('请填写邮箱');
        return false;
      }
      
      axios.post('http://127.0.0.1:8000/registers/',{username:this.username,password:this.password,pthone:this.pthone,emial:this.emial,password1:this.password1}).then(res=>{
       
          alert(res.data.msg)
        
      })
  
    }
  },
  created() {},
};

</script>

<style scoped>
</style>
}